package com.zer0.tga.entity.abstractentity;

import com.zer0.tga.art.Bitmap;
import com.zer0.tga.art.Screen;
import com.zer0.tga.entity.Entity;
import com.zer0.tga.entity.livingentity.Teemo;
import com.zer0.tga.math.Coordinate;
import com.zer0.tga.math.Direction;

public class Damager extends AbstractEntity{
	
	
	public int damage;
	private int time;
	private int endTime;

	public Damager(Coordinate position, Coordinate radius, int damage , int endTime) {
		// TODO Auto-generated constructor stub
		setPositionAndRadius(position, radius);
		this.damage = damage;
		this.endTime = endTime;
	}
	
	public void tick()
	{
		time++;
		
		if(time+50 > endTime)
		{
			this.removed = true;
		}
	}


	public boolean collision(Entity entity, Direction collisionDir) {
		// TODO Auto-generated method stub
	/*	if(entity instanceof Teemo)
		{
			((Teemo) entity).hurt(damage, 1000);
		}
		return false;*/
		return true;
	}
	

	public void render(Screen screen)
	{
		//System.out.println("rendering");
		Bitmap b = new Bitmap((int)radius.x*2,(int)radius.y*2);
		b.clearWithColor(0xff00aa00);
		screen.draw(b.fade(endTime-time, endTime),position.x-radius.x,position.y-radius.y,position.x+radius.x,position.y+radius.y);

	}
	
	public boolean blocks(Entity e) {
		if(e instanceof Teemo)
			return true;
		return false;
		
	}	
}
